#!/usr/bin/node

//引入可读流的模块对象，在可读流的模块下的Readable

var Writable=require('stream').Writable;

//继承模块
var util=require('util');




function GreenStream(){
  Writable.call(this);
}


GreenStream.prototype._write=function(chunk,encoding,callback){
  process.stdout.write('\033[1;32m'+chunk.slice(0,chunk.length-1)+'\033[1;37m');
  callback;
};

//实现继承
util.inherits(GreenStream,Writable);
process.stdin.pipe(new GreenStream());
